(function () {
    // console.log(1)
    let back = document.querySelector('.back')

    back.addEventListener('click', function () {
        // console.log(1)
        history.back()
    })

    $.ajax({
        url: `http://chst.vip:1234/api/getcoupon`,
        success(res) {
            // console.log(res.result)
            let str = ''
            res.result.forEach(item => {
                console.log(item)
                str += `
                <a href="javascript:;" couponId=${item.couponId} >${item.couponTitle}</a>

                `
            })
            $('.info').html(str)
        }
    })

    $('.info').click(function(e){
        // console.log(e.target.getAttribute('couponId'))
        let id = e.target.getAttribute('couponId')
        location.href=`../pages/TicParticulars.html?couponId=${id}`
    })
})()